<div id="pageInfo" data-title="商品搜索"></div>
<style>
.s_type{
	color: red;
	text-align: right;
	line-height: 0.3rem;
}
</style>
<?php 
	//$type   = ISession::get('plate_type');
?>
{set:$defaultWhere = array('search' => $this->word, 'category_extend' => $this->cat_id)}
{set:$goodsObj = search_goods::find($defaultWhere,10);$resultData = $goodsObj->find();}
{if:$resultData}
<aside class="goods_sort">
    {foreach:items=search_goods::getOrderType()}
    <span class="sort_btn" onclick="gourl('{echo:search_goods::searchUrl(array('order','by'),array($key,search_goods::getOrderBy($key)))}')">{$item}</span>
    {/foreach}
</aside>
<section class="goods_list">
    <ul>
        {foreach:items=$resultData}
        <li>
            <a href="{url:/site/products/id/$item[id]}">
                <i class="photo"><img class="goods_photo" src="{url:/pic/thumb/img/$item[img]/w/200/h/200}" alt="{$item['name']}"></i>
                <h3 class="name"><strong>{$item['name']}</strong></h3>
                {if:$item['good_type'] == 2}
					<h5 class="s_type">到店</h5>
				{/if}
				
                <del class="old_price">￥{$item['market_price']}</del>
                <em class="price">￥{$item['sell_price']}</em>
            </a>
        </li>
        {/foreach}
    </ul>
</section>
{$goodsObj->getPageBar()}
{else:}
<section class="nodata">搜索结果为零</section>
{/if}

<script>
$(function(){
    // 隐藏底部导航
    //hideNav();

    // 切换导航样式
    var order = getUrlParam("order");
    var sortBtn = $(".goods_sort").children('.sort_btn');
    // sortBtn.eq(2).append('<i>');
    if(order=="sale"){
        sortBtn.eq(0).addClass('on').append('<i class="icon-angle-down"></i>');
    }else if (order=="sale_toggle"){
        sortBtn.eq(0).addClass('on').append('<i class="icon-angle-up"></i>');
    }else if (order=="cpoint"){
        sortBtn.eq(1).addClass('on').append('<i class="icon-angle-down"></i>');
    }else if(order=="cpoint_toggle"){
        sortBtn.eq(1).addClass('on').append('<i class="icon-angle-up"></i>');
    }else if(order=="price"){
        sortBtn.eq(2).addClass('on').append('<i class="icon-angle-down"></i>');
    }else if(order=="price_toggle"){
        sortBtn.eq(2).addClass('on').append('<i class="icon-angle-up"></i>');
    }else if(order=="new"){
        sortBtn.eq(3).addClass('on').append('<i class="icon-angle-down"></i>');
    }else if(order=="new_toggle"){
        sortBtn.eq(3).addClass('on').append('<i class="icon-angle-up"></i>');
    }else{
        sortBtn.eq(0).addClass('on');
    };
});
</script>
